|
Virtual Hostings
2013/05/11 |
|
It's the example to configure virtual hostings. Following example is done as domain name[srv.world],
virtual domain name[virtual.host (root directory[/home/wheezy/public_html])]. Before doing it,
it's necessarry to add new doman name in your DNS first.
|
|
| [1] | Configure Virtual Hostings |
|
root@www:~#
vi /etc/apache2/sites-available/virtual.host # create a file for virtual.host
<VirtualHost *:80>
ServerName www.virtual.host
ServerAdmin webmaster@virtual.host
DocumentRoot /home/wheezy/public_html
ErrorLog /var/log/apache2/virtual.host.error.log
CustomLog /var/log/apache2/virtual.host.access.log combined
LogLevel warn
</VirtualHost>
a2ensite virtual.host Enabling site virtual.host. Run '/etc/init.d/apache2 reload' to activate new configuration! root@www:~# /etc/init.d/apache2 restart Restarting web server: apache2 ... waiting . |
| [2] | Create a test page and access to it with web browser. It's OK if following page is shown. |
|
wheezy@www:~$ cd public_html
wheezy@www:~/public_html$
vi virtual.cgi #!/usr/bin/perl print "Content-type: text/html\n\n"; print "<html>\n<body>\n"; print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n"; print "Virtual Host Test Page"; print "\n</div>\n"; print "</body>\n</html>\n"; chmod 705 virtual.cgi |
|